<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Андрей
 * Date: 11.05.12
 * Time: 18:08
 * To change this template use File | Settings | File Templates.
 */
 

    class IndexController extends ControllerAbstract
    {
       public function index()
        {
            $user = UserModelMapper::getCurrentUser();
            if (!$user->isAuthorized())
            {
                $this->_view->noAuth = true;
            }

            $uMapper = new UserModelMapper();
            $users = $uMapper->fetchAllUsers();

            $this->_view->users = array();
            
            if ($users)
            {
                foreach($users as $usr)
                {
                    $id = $usr->getId();
                    $this->_view->users[$id]['login'] = $usr->getLogin();
                }
            }

            $this->_view->setRenderTemplate("index.phtml");
        }
        
    }
